package com.token.sysflow.bean;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;
import com.token.sql.IntegrateSql;
import com.token.sql.AbstractTableBean;
/**
 * 环节知会行项目
 * @author 代码创建
 */
public class FlowStepNotifySub extends AbstractTableBean {

	private String NotifyID; //主键
	private String StepId; //环节ID
	private String FlowId; //流程ID
	private String ExtWay; //执行方式
	private String NotifySubject; //知会主题
	private String NotifyContext; //知会内容
	private String NotifyObject; //知会对象
	private String CreOrApply; //起草人/申请人
	private String NotifyFieldName; //指定人域
	private String Conditional; //条件判断公式
	private String IsInConfig; //启用公式
	private String Sortby; //排列次序
	private String ConditionalApi; //条件判断接口

	public static String TABLE_NAME = "Flow_StepNotify_Sub";
	public static String TABLEKEY_NAME = "NotifyID";
	public FlowStepNotifySub (IntegrateSql f){
		super(f,TABLE_NAME);
		this.setKeyName(TABLEKEY_NAME);
	}

	public FlowStepNotifySub (IntegrateSql f,ResultSet rs) throws SQLException{
		super(f,TABLE_NAME);
		this.setKeyName(TABLEKEY_NAME);
		this.initParamToRs(rs);
	}

	public FlowStepNotifySub (IntegrateSql f,String keyValue) throws SQLException{
		super(f,TABLE_NAME);
		this.setKeyName(TABLEKEY_NAME);
		setCodePrepare(selectCodeById().toString());
		prepareSql.setPstValue(1, keyValue);
		ResultSet rs = executeQuery();
		if(rs.next()){
			initParamToRs(rs);
		}else{
			initParam();
		}
		rs.close();
	}

	@Override
	protected void initParam() {
		NotifyID = ""; //主键
		StepId = ""; //环节ID
		FlowId = ""; //流程ID
		ExtWay = ""; //执行方式
		NotifySubject = ""; //知会主题
		NotifyContext = ""; //知会内容
		NotifyObject = ""; //知会对象
		CreOrApply = ""; //起草人/申请人
		NotifyFieldName = ""; //指定人域
		Conditional = ""; //条件判断公式
		IsInConfig = ""; //启用公式
		Sortby = ""; //排列次序
		ConditionalApi = ""; //条件判断接口
	}


	public void initParamToRs(ResultSet rs) throws SQLException{
		NotifyID = rs.getString("NotifyID"); //主键
		StepId = rs.getString("StepId"); //环节ID
		FlowId = rs.getString("FlowId"); //流程ID
		ExtWay = rs.getString("ExtWay"); //执行方式
		NotifySubject = rs.getString("NotifySubject"); //知会主题
		NotifyContext = rs.getString("NotifyContext"); //知会内容
		NotifyObject = rs.getString("NotifyObject"); //知会对象
		CreOrApply = rs.getString("CreOrApply"); //起草人/申请人
		NotifyFieldName = rs.getString("NotifyFieldName"); //指定人域
		Conditional = rs.getString("Conditional"); //条件判断公式
		IsInConfig = rs.getString("IsInConfig"); //启用公式
		Sortby = rs.getString("Sortby"); //排列次序
		ConditionalApi = rs.getString("ConditionalApi"); //条件判断接口
		this.setKeyId(rs.getString("NotifyID"));
	}


	@Override
	protected int appendData() throws SQLException {
		int i = 1;
		prepareSql.setPstValue(i++,NotifyID); //主键
		prepareSql.setPstValue(i++,StepId); //环节ID
		prepareSql.setPstValue(i++,FlowId); //流程ID
		prepareSql.setPstValue(i++,ExtWay); //执行方式
		prepareSql.setPstValue(i++,NotifySubject); //知会主题
		prepareSql.setPstValue(i++,NotifyContext); //知会内容
		prepareSql.setPstValue(i++,NotifyObject); //知会对象
		prepareSql.setPstValue(i++,CreOrApply); //起草人/申请人
		prepareSql.setPstValue(i++,NotifyFieldName); //指定人域
		prepareSql.setPstValue(i++,Conditional); //条件判断公式
		prepareSql.setPstValue(i++,IsInConfig); //启用公式
		prepareSql.setPstValue(i++,Sortby); //排列次序
		prepareSql.setPstValue(i++,ConditionalApi); //条件判断接口
		return i;
	}


	@Override
	public Vector<String> getFields() {
		Vector<String> vec = new Vector<String>();
		vec.addElement("NotifyID"); //主键
		vec.addElement("StepId"); //环节ID
		vec.addElement("FlowId"); //流程ID
		vec.addElement("ExtWay"); //执行方式
		vec.addElement("NotifySubject"); //知会主题
		vec.addElement("NotifyContext"); //知会内容
		vec.addElement("NotifyObject"); //知会对象
		vec.addElement("CreOrApply"); //起草人/申请人
		vec.addElement("NotifyFieldName"); //指定人域
		vec.addElement("Conditional"); //条件判断公式
		vec.addElement("IsInConfig"); //启用公式
		vec.addElement("Sortby"); //排列次序
		vec.addElement("ConditionalApi"); //条件判断接口
		return vec;
	}


	/**
	 * 设置主键
	 * @param notifyid
	 */
	public void setNotifyID(String notifyid){
		NotifyID = notifyid;
	}
	/**
	 * 获取NotifyID
	 * @return 主键
	 */
	public String getNotifyID(){
		return NotifyID;
	}

	/**
	 * 设置环节ID
	 * @param stepid
	 */
	public void setStepId(String stepid){
		StepId = stepid;
	}
	/**
	 * 获取StepId
	 * @return 环节ID
	 */
	public String getStepId(){
		return StepId;
	}

	/**
	 * 设置流程ID
	 * @param flowid
	 */
	public void setFlowId(String flowid){
		FlowId = flowid;
	}
	/**
	 * 获取FlowId
	 * @return 流程ID
	 */
	public String getFlowId(){
		return FlowId;
	}

	/**
	 * 设置执行方式
	 * @param extway
	 */
	public void setExtWay(String extway){
		ExtWay = extway;
	}
	/**
	 * 获取ExtWay
	 * @return 执行方式
	 */
	public String getExtWay(){
		return ExtWay;
	}

	/**
	 * 设置知会主题
	 * @param notifysubject
	 */
	public void setNotifySubject(String notifysubject){
		NotifySubject = notifysubject;
	}
	/**
	 * 获取NotifySubject
	 * @return 知会主题
	 */
	public String getNotifySubject(){
		return NotifySubject;
	}

	/**
	 * 设置知会内容
	 * @param notifycontext
	 */
	public void setNotifyContext(String notifycontext){
		NotifyContext = notifycontext;
	}
	/**
	 * 获取NotifyContext
	 * @return 知会内容
	 */
	public String getNotifyContext(){
		return NotifyContext;
	}

	/**
	 * 设置知会对象
	 * @param notifyobject
	 */
	public void setNotifyObject(String notifyobject){
		NotifyObject = notifyobject;
	}
	/**
	 * 获取NotifyObject
	 * @return 知会对象
	 */
	public String getNotifyObject(){
		return NotifyObject;
	}

	/**
	 * 设置起草人/申请人
	 * @param creorapply
	 */
	public void setCreOrApply(String creorapply){
		CreOrApply = creorapply;
	}
	/**
	 * 获取CreOrApply
	 * @return 起草人/申请人
	 */
	public String getCreOrApply(){
		return CreOrApply;
	}

	/**
	 * 设置指定人域
	 * @param notifyfieldname
	 */
	public void setNotifyFieldName(String notifyfieldname){
		NotifyFieldName = notifyfieldname;
	}
	/**
	 * 获取NotifyFieldName
	 * @return 指定人域
	 */
	public String getNotifyFieldName(){
		return NotifyFieldName;
	}

	/**
	 * 设置条件判断公式
	 * @param conditional
	 */
	public void setConditional(String conditional){
		Conditional = conditional;
	}
	/**
	 * 获取Conditional
	 * @return 条件判断公式
	 */
	public String getConditional(){
		return Conditional;
	}

	/**
	 * 设置启用公式
	 * @param isinconfig
	 */
	public void setIsInConfig(String isinconfig){
		IsInConfig = isinconfig;
	}
	/**
	 * 获取IsInConfig
	 * @return 启用公式
	 */
	public String getIsInConfig(){
		return IsInConfig;
	}

	/**
	 * 设置排列次序
	 * @param sortby
	 */
	public void setSortby(String sortby){
		Sortby = sortby;
	}
	/**
	 * 获取Sortby
	 * @return 排列次序
	 */
	public String getSortby(){
		return Sortby;
	}

	/**
	 * 设置条件判断接口
	 * @param conditionalapi
	 */
	public void setConditionalApi(String conditionalapi){
		ConditionalApi = conditionalapi;
	}
	/**
	 * 获取ConditionalApi
	 * @return 条件判断接口
	 */
	public String getConditionalApi(){
		return ConditionalApi;
	}

}
